/**
 * Copyright (C) 2009 Bruno Dumas (bruno.dumas -at- unifr.ch), DIVA group, University of Fribourg, Switzerland
 * 
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */

package it.unina.lab.xml;

import java.io.Serializable;

public class Attribute implements Serializable {

	private static final long serialVersionUID = 8505215662782518179L;
	private String name;
	private String namespace;
	private String value;
	private int id = -1;

	public Attribute(String name, String value) {
		this.name = name;
		this.value = value;
	}

	public Attribute(String name, String value, int id){
	    this(name, value);
	    this.id = id;
	  }

	public Attribute(String namespace, String name, String value) {
		this.namespace = namespace;
		this.name = name;
		this.value = value;
	}

	public Attribute(String namespace, String name, String value, int id){
	    this(namespace, name, value);
	    this.id = id;
	  }

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return Returns the namespace.
	 */
	public String getNamespace() {
		return namespace;
	}
	/**
	 * @param namespace The namespace to set.
	 */
	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}
	/**
	 * @return Returns the value.
	 */
	public String getValue() {
		return value;
	}
	/**
	 * @param value The value to set.
	 */
	public void setValue(String value) {
		this.value = value;
	}

	public String toString(){
		if(namespace != null){
			return(namespace+":"+name+"=\""+value+"\"");
		}else{
			return(name+"=\""+value+"\"");
		}
	}

	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}
}
